﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter4.Section4
{
    public class Example08
    {
        public Example08()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double[]> f
                = new V.Function.ToLastType<double[], double[]>(ff);
            double[] x = { 1.0, 2.0, 3.0 };
            V.Curl delcrossf = new V.Curl(f, x);
            delcrossf.Compute();
            result += delcrossf.Result[0].ToString() + "\r\n";
            result += delcrossf.Result[1].ToString() + "\r\n";
            result += delcrossf.Result[2].ToString() + "\r\n";
            x[0] = 2.0;
            x[1] = 4.0;
            x[2] = Math.PI;
            delcrossf.Compute();
            result += delcrossf.Result[0].ToString() + "\r\n";
            result += delcrossf.Result[1].ToString() + "\r\n";
            result += delcrossf.Result[2].ToString() + "\r\n";
        }
        private double[] ff(double[] x)
        {
            double[] r = new double[3];
            r[0] = x[0] * x[1];
            r[1] = -Math.Sin(x[2]);
            r[2] = 1.0;
            return r;
        }
    }
}

/*
-0.989992496600256
0
-1.00000000000015
-0.999999999999771
0
-1.9999999999995
*/